//
// Created by sjjmw on 3/24/2022.
//
#include "iostream"
#include "vector"
#include "list"

//找第二大，遍历即可，找到最大的，把上一个最大作为第二大
void handle(int n){
    int max=INT_MIN,second=INT_MIN;
    std::list<int> vec;
    std::list<int> max_vec;
    for(int i=0;i<n;i++){
        int in;std::cin>>in;
        if(in==max){
            max_vec.push_back(i);
        }
        else if(in>max){
            second=max;
            max=in;
            vec=max_vec;
            max_vec.clear();
            max_vec.push_back(i);
        }else if(in>second){
            second=in;
            vec.clear();
            vec.push_back(i);
        }else if(in==second){
            vec.push_back(i);
        }
    }
    if(second==INT_MIN){
        printf("none\n");
    }else{
        printf("%d",second);
        for(auto i:vec){
            printf(" %d",i);
        }
        printf("\n");
    }
}

int main(){
    int in;
    while(std::cin>>in){
        handle(in);
    }
    return 0;
}